home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / X11 / XReadBitmapFile.z / XReadBitmapFile
Encoding:
Text File  |  1998-10-30  |  11.5 KB  |  264 lines

  1.  
  2.  
  3.  
  4.      XXXXRRRReeeeaaaaddddBBBBiiiittttmmmmaaaappppFFFFiiiilllleeee((((3333XXXX11111111))))XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 6666....3333))))XXXXRRRReeeeaaaaddddBBBBiiiittttmmmmaaaappppFFFFiiiilllleeee((((3333XXXX11111111))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.           XReadBitmapFile, XReadBitmapFileData, XWriteBitmapFile,
  10.           XCreatePixmapFromBitmapData, XCreateBitmapFromData -
  11.           manipulate bitmaps
  12.  
  13.      SSSSYYYYNNNNTTTTAAAAXXXX
  14.           int XReadBitmapFile(_d_i_s_p_l_a_y, _d, _f_i_l_e_n_a_m_e, _w_i_d_t_h__r_e_t_u_r_n,
  15.           _h_e_i_g_h_t__r_e_t_u_r_n, _b_i_t_m_a_p__r_e_t_u_r_n, _x__h_o_t__r_e_t_u_r_n,
  16.                                  _y__h_o_t__r_e_t_u_r_n)
  17.                 Display *_d_i_s_p_l_a_y;
  18.                 Drawable _d;
  19.                 char *_f_i_l_e_n_a_m_e;
  20.                 unsigned int *_w_i_d_t_h__r_e_t_u_r_n, *_h_e_i_g_h_t__r_e_t_u_r_n;
  21.                 Pixmap *_b_i_t_m_a_p__r_e_t_u_r_n;
  22.                 int *_x__h_o_t__r_e_t_u_r_n, *_y__h_o_t__r_e_t_u_r_n;
  23.  
  24.           int XReadBitmapFileData(_f_i_l_e_n_a_m_e, _w_i_d_t_h__r_e_t_u_r_n,
  25.           _h_e_i_g_h_t__r_e_t_u_r_n, _d_a_t_a__r_e_t_u_r_n, _x__h_o_t__r_e_t_u_r_n, _y__h_o_t__r_e_t_u_r_n)
  26.                 char *_f_i_l_e_n_a_m_e;
  27.                 unsigned int *_w_i_d_t_h__r_e_t_u_r_n, *_h_e_i_g_h_t__r_e_t_u_r_n;
  28.                 unsigned char *_d_a_t_a__r_e_t_u_r_n;
  29.                 int *_x__h_o_t__r_e_t_u_r_n, *_y__h_o_t__r_e_t_u_r_n;
  30.  
  31.           int XWriteBitmapFile(_d_i_s_p_l_a_y, _f_i_l_e_n_a_m_e, _b_i_t_m_a_p, _w_i_d_t_h,
  32.           _h_e_i_g_h_t, _x__h_o_t, _y__h_o_t)
  33.                 Display *_d_i_s_p_l_a_y;
  34.                 char *_f_i_l_e_n_a_m_e;
  35.                 Pixmap _b_i_t_m_a_p;
  36.                 unsigned int _w_i_d_t_h, _h_e_i_g_h_t;
  37.                 int _x__h_o_t, _y__h_o_t;
  38.  
  39.           Pixmap XCreatePixmapFromBitmapData(_d_i_s_p_l_a_y, _d, _d_a_t_a, _w_i_d_t_h,
  40.           _h_e_i_g_h_t, _f_g, _b_g, _d_e_p_t_h)
  41.                Display *_d_i_s_p_l_a_y;
  42.                Drawable _d;
  43.                char *_d_a_t_a;
  44.                unsigned int _w_i_d_t_h, _h_e_i_g_h_t;
  45.                unsigned long _f_g, _b_g;
  46.                unsigned int _d_e_p_t_h;
  47.  
  48.           Pixmap XCreateBitmapFromData(_d_i_s_p_l_a_y, _d, _d_a_t_a, _w_i_d_t_h,
  49.           _h_e_i_g_h_t)
  50.                 Display *_d_i_s_p_l_a_y;
  51.                 Drawable _d;
  52.                 char *_d_a_t_a;
  53.                 unsigned int _w_i_d_t_h, _h_e_i_g_h_t;
  54.  
  55.      AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
  56.           _b_i_t_m_a_p    Specifies the bitmap.
  57.  
  58.           _b_i_t_m_a_p__r_e_t_u_r_n
  59.                     Returns the bitmap that is created.
  60.  
  61.  
  62.  
  63.      Page 1                                          (printed 4/30/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      XXXXRRRReeeeaaaaddddBBBBiiiittttmmmmaaaappppFFFFiiiilllleeee((((3333XXXX11111111))))XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 6666....3333))))XXXXRRRReeeeaaaaddddBBBBiiiittttmmmmaaaappppFFFFiiiilllleeee((((3333XXXX11111111))))
  71.  
  72.  
  73.  
  74.           _d         Specifies the drawable that indicates the screen.
  75.  
  76.           _d_a_t_a      Specifies the data in bitmap format.
  77.  
  78.           _d_a_t_a      Specifies the location of the bitmap data.
  79.  
  80.           _d_a_t_a__r_e_t_u_r_n
  81.                     Returns the bitmap data.
  82.  
  83.           _d_e_p_t_h     Specifies the depth of the pixmap.
  84.  
  85.           _d_i_s_p_l_a_y   Specifies the connection to the X server.
  86.  
  87.           _f_g
  88.           _b_g        Specify the foreground and background pixel values
  89.                     to use.
  90.  
  91.           _f_i_l_e_n_a_m_e  Specifies the file name to use.  The format of the
  92.                     file name is operating-system dependent.
  93.  
  94.           _w_i_d_t_h
  95.           _h_e_i_g_h_t    Specify the width and height.
  96.  
  97.           _w_i_d_t_h__r_e_t_u_r_n
  98.           _h_e_i_g_h_t__r_e_t_u_r_n
  99.                     Return the width and height values of the read in
  100.                     bitmap file.
  101.  
  102.           _x__h_o_t
  103.           _y__h_o_t     Specify where to place the hotspot coordinates (or
  104.                     -1,-1 if none are present) in the file.
  105.  
  106.           _x__h_o_t__r_e_t_u_r_n
  107.           _y__h_o_t__r_e_t_u_r_n
  108.                     Return the hotspot coordinates.
  109.  
  110.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  111.           The _X_R_e_a_d_B_i_t_m_a_p_F_i_l_e function reads in a file containing a
  112.           bitmap.  The file is parsed in the encoding of the current
  113.           locale.  The ability to read other than the standard format
  114.           is implementation-dependent.  If the file cannot be opened,
  115.           _X_R_e_a_d_B_i_t_m_a_p_F_i_l_e returns _B_i_t_m_a_p_O_p_e_n_F_a_i_l_e_d.  If the file can
  116.           be opened but does not contain valid bitmap data, it returns
  117.           _B_i_t_m_a_p_F_i_l_e_I_n_v_a_l_i_d.  If insufficient working storage is
  118.           allocated, it returns _B_i_t_m_a_p_N_o_M_e_m_o_r_y.  If the file is
  119.           readable and valid, it returns _B_i_t_m_a_p_S_u_c_c_e_s_s.
  120.  
  121.           _X_R_e_a_d_B_i_t_m_a_p_F_i_l_e returns the bitmap's height and width, as
  122.           read from the file, to width_return and height_return.  It
  123.           then creates a pixmap of the appropriate size, reads the
  124.           bitmap data from the file into the pixmap, and assigns the
  125.           pixmap to the caller's variable bitmap. The caller must free
  126.  
  127.  
  128.  
  129.      Page 2                                          (printed 4/30/98)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      XXXXRRRReeeeaaaaddddBBBBiiiittttmmmmaaaappppFFFFiiiilllleeee((((3333XXXX11111111))))XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 6666....3333))))XXXXRRRReeeeaaaaddddBBBBiiiittttmmmmaaaappppFFFFiiiilllleeee((((3333XXXX11111111))))
  137.  
  138.  
  139.  
  140.           the bitmap using _X_F_r_e_e_P_i_x_m_a_p when finished.  If _n_a_m_e_x_hot
  141.           and _n_a_m_e_y_hot exist, _X_R_e_a_d_B_i_t_m_a_p_F_i_l_e returns them to
  142.           x_hot_return and y_hot_return; otherwise, it returns -1,-1.
  143.  
  144.           _X_R_e_a_d_B_i_t_m_a_p_F_i_l_e can generate _B_a_d_A_l_l_o_c and _B_a_d_D_r_a_w_a_b_l_e
  145.           errors.
  146.  
  147.           The _X_R_e_a_d_B_i_t_m_a_p_F_i_l_e_D_a_t_a function reads in a file containing
  148.           a bitmap, in the same manner as _X_R_e_a_d_B_i_t_m_a_p_F_i_l_e, but returns
  149.           the data directly rather than creating a pixmap in the
  150.           server.  The bitmap data is returned in data_return; the
  151.           client must free this storage when finished with it by
  152.           calling _X_F_r_e_e.  The status and other return values are the
  153.           same as for _X_R_e_a_d_B_i_t_m_a_p_F_i_l_e.
  154.  
  155.           The _X_W_r_i_t_e_B_i_t_m_a_p_F_i_l_e function writes a bitmap out to a file
  156.           in the X Version 11 format.  The name used in the output
  157.           file is derived from the file name by deleting the directory
  158.           prefix.  The file is written in the encoding of the current
  159.           locale.  If the file cannot be opened for writing, it
  160.           returns _B_i_t_m_a_p_O_p_e_n_F_a_i_l_e_d.  If insufficient memory is
  161.           allocated, _X_W_r_i_t_e_B_i_t_m_a_p_F_i_l_e returns _B_i_t_m_a_p_N_o_M_e_m_o_r_y;
  162.           otherwise, on no error, it returns _B_i_t_m_a_p_S_u_c_c_e_s_s.  If x_hot
  163.           and y_hot are not -1, -1, _X_W_r_i_t_e_B_i_t_m_a_p_F_i_l_e writes them out
  164.           as the hotspot coordinates for the bitmap.
  165.  
  166.           _X_W_r_i_t_e_B_i_t_m_a_p_F_i_l_e can generate _B_a_d_D_r_a_w_a_b_l_e and _B_a_d_M_a_t_c_h
  167.           errors.
  168.  
  169.           The _X_C_r_e_a_t_e_P_i_x_m_a_p_F_r_o_m_B_i_t_m_a_p_D_a_t_a function creates a pixmap of
  170.           the given depth and then does a bitmap-format _X_P_u_t_I_m_a_g_e of
  171.           the data into it.  The depth must be supported by the screen
  172.           of the specified drawable, or a _B_a_d_M_a_t_c_h error results.
  173.  
  174.           _X_C_r_e_a_t_e_P_i_x_m_a_p_F_r_o_m_B_i_t_m_a_p_D_a_t_a can generate _B_a_d_A_l_l_o_c and
  175.           _B_a_d_M_a_t_c_h errors.
  176.  
  177.           The _X_C_r_e_a_t_e_B_i_t_m_a_p_F_r_o_m_D_a_t_a function allows you to include in
  178.           your C program (using #_i_n_c_l_u_d_e) a bitmap file that was
  179.           written out by _X_W_r_i_t_e_B_i_t_m_a_p_F_i_l_e (X version 11 format only)
  180.           without reading in the bitmap file.  The following example
  181.           creates a gray bitmap:
  182.  
  183.           #include "gray.bitmap"
  184.           Pixmap bitmap;
  185.           bitmap = XCreateBitmapFromData(display, window, gray_bits, gray_width, gray_height);
  186.  
  187.           If insufficient working storage was allocated,
  188.           _X_C_r_e_a_t_e_B_i_t_m_a_p_F_r_o_m_D_a_t_a returns _N_o_n_e.  It is your
  189.           responsibility to free the bitmap using _X_F_r_e_e_P_i_x_m_a_p when
  190.           finished.
  191.  
  192.  
  193.      Page 3                                          (printed 4/30/98)
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.      XXXXRRRReeeeaaaaddddBBBBiiiittttmmmmaaaappppFFFFiiiilllleeee((((3333XXXX11111111))))XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 6666....3333))))XXXXRRRReeeeaaaaddddBBBBiiiittttmmmmaaaappppFFFFiiiilllleeee((((3333XXXX11111111))))
  201.  
  202.  
  203.  
  204.           _X_C_r_e_a_t_e_B_i_t_m_a_p_F_r_o_m_D_a_t_a can generate a _B_a_d_A_l_l_o_c error.
  205.  
  206.      DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  207.           _B_a_d_A_l_l_o_c  The server failed to allocate the requested
  208.                     resource or server memory.
  209.  
  210.           _B_a_d_D_r_a_w_a_b_l_e
  211.                     A value for a Drawable argument does not name a
  212.                     defined Window or Pixmap.
  213.  
  214.           _B_a_d_M_a_t_c_h  An _I_n_p_u_t_O_n_l_y window is used as a Drawable.
  215.  
  216.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  217.           XCreatePixmap(3X11), XPutImage(3X11)
  218.           _X_l_i_b - _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.      Page 4                                          (printed 4/30/98)
  260.  
  261.  
  262.  
  263.